package com.ctosb.classviewer.clazz;

import com.ctosb.classviewer.ClassReader;
import lombok.ToString;

public abstract class AbstractParse implements Parseable{

    /**
     * classfile对象，便于后面解析使用
     */
    @ToString.Exclude
    private transient ClassFile classFile;

    public <T> T parse(ClassReader classReader, ClassFile classFile) {
        setClassFile(classFile);
        return parse(classReader);
    }

    public ClassFile getClassFile() {
        return classFile;
    }

    protected  <T> T setClassFile(ClassFile classFile) {
        this.classFile = classFile;
        return (T) this;
    }
}
